﻿@model Nop.Web.Models.Customer.CustomerAddressListModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
@using Nop.Web.Framework;
@section left
{
    @Html.Partial("MyAccountNavigation", Model.NavigationModel, new ViewDataDictionary())
}
<div class="account-page">
    <div class="page-title">
        <h1>@T("Account.MyAccount") - @T("Account.CustomerAddresses")</h1>
    </div>
    <div class="clear">
    </div>
    <div class="body">
        <div class="customer-addresses">
            <div class="address-list">
                @if (Model.Addresses.Count > 0)
                {
                    for (int i = 0; i < Model.Addresses.Count; i++)
                    {
                        var address = Model.Addresses[i];
                    <div class="address-item">
                        <table width="100%" cellspacing="0" cellpadding="2" border="0">
                            <tbody>
                                <tr>
                                    <td>
                                        <b>@address.FirstName @address.LastName</b>
                                    </td>
                                    <td class="buttons">
                                        <input type="button" class="editaddressbutton" onclick="location.href='@Url.RouteUrl("CustomerAddressEdit", new { addressId = address.Id })'" value='@T("Common.Edit")' />
                                        <input type="submit"  class="deleteaddressbutton" onclick="location.href='@Url.RouteUrl("CustomerAddressDelete", new { addressId = address.Id })'" value="@T("Common.Delete")" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <div>
                                            @address.FirstName @address.LastName<br />
                                            <div>
                                                @Html.LabelFor(model => model.Addresses[i].Email):
                                                @address.Email
                                            </div>
                                            <div>
                                                @Html.LabelFor(model => model.Addresses[i].PhoneNumber):
                                                @address.PhoneNumber
                                            </div>
                                            <div>
                                                @Html.LabelFor(model => model.Addresses[i].FaxNumber):
                                                @address.FaxNumber</div>
                                            @if (!String.IsNullOrEmpty(address.Company))
                                            {
                                                <div>@address.Company</div>
                                            }
                                            <div>
                                                @address.Address1</div>
                                            @if (!String.IsNullOrEmpty(address.Address2))
                                            {
                                                <div>
                                                    @address.Address2</div>
                                            }
                                            <div>
                                                @address.City,
                                                @address.StateProvinceName
                                                @address.ZipPostalCode</div>
                                            @if (!String.IsNullOrEmpty(address.CountryName))
                                            {
                                                <div>
                                                    @address.CountryName
                                                </div>
                                            }
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
            
                    if (i != Model.Addresses.Count - 1)
                    {
                    <div class="clear">
                    </div>
                    }
                    }
                }
                else
                {
                    @T("Account.CustomerAddresses.NoAddresses")
                }
            </div>
            <div class="clear">
            </div>
            <div class="add-button">
                <input type="submit" class="addaddressbutton" onclick="location.href='@Url.RouteUrl("CustomerAddressAdd")'" value="@T("Common.AddNew")" />
            </div>
        </div>
    </div>
</div>
